﻿<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> 
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="azure" uri="http://taglib.lmpop.com/azure/taglib" %>
<%@ page import="com.lmpop.createIndex.search.*" %>
<%@page import="com.lmpop.trade.ti_news.*" %>
<%@page import="com.lmpop.frame.util.PageTools" %>
<%!
	public String getPartLength(String key,int num){
		if(key.equals("")) return "";
		if(key.length()>num) key = key.substring(0,num)+"...";
		return key;
	}
	public String getDateStr(String in_date,String type){if(in_date.equals("")) return "";
		if(in_date.length()>=8){
			String yeard = in_date.substring(0,4);
			String monthd = in_date.substring(4,6);
			String dayd = in_date.substring(6,8);
			if(type.equals("")){
				in_date = yeard+"-"+monthd+"-"+dayd;
			}else{
				in_date = yeard+"-"+monthd+"-"+dayd;
			}
		}
		return in_date;
	}
%>

<%
	request.setCharacterEncoding("UTF-8");
	CategoryIndexFiles catIndex = new CategoryIndexFiles();
	String s_keyword = "",isimg="";
	Map newsMap = new Hashtable();
	if(request.getParameter("keyword")!=null && !request.getParameter("keyword").equals("")){
		s_keyword = request.getParameter("keyword");
		newsMap.put("title",s_keyword);
	}
	if(request.getParameter("s_keyword")!=null && !request.getParameter("s_keyword").equals("")){
		s_keyword = request.getParameter("s_keyword");
		newsMap.put("title",s_keyword);
	}
	if(request.getParameter("img")!=null && !request.getParameter("img").equals("")){
		isimg = request.getParameter("img");
		newsMap.put("isimg",isimg);
	}
	newsMap.put("cat_attr","XS2dT78fq106V0D|");
	NewsIndexFiles newsIndex=new NewsIndexFiles();
	String iStart = "0";
	int limit = 50;
	if(request.getParameter("iStart")!=null && !request.getParameter("iStart").equals(""))
	iStart = request.getParameter("iStart");
	int counter=0;
	List newsList=newsIndex.getNewsInfo(newsMap);
	if (newsList != null && newsList.size() > 0){
		newsMap = (Hashtable)newsList.get(0);
		if(newsMap!=null&&!(newsMap.get("news_id").toString()).equals("0")){
			counter = newsList.size();
		}
	}
		
	newsMap.put("order_by","e");	 //最新推荐
	List clicknumlist = newsIndex.getNewsInfo(newsMap);//ti_newsInfo.getListByPage(newsMap,Integer.parseInt(iStart),10);
	newsMap.put("order_by","num");	
	List commentnumlist =newsIndex.getNewsInfo(newsMap);// ti_newsInfo.getListByPage(newsMap,Integer.parseInt(iStart),10);
	String pageString =new PageTools().getGoogleToolsBar(counter,"/shop_newslist.html?cat_attr=XS2dT78fq106V0D|&keyword="+s_keyword+"&iStart=",Integer.parseInt(iStart),limit);
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>导购资讯-雷鸣商城</title>
<link rel="stylesheet" type="text/css" href="/templets/html/shop/css/news.css" />
<link rel="stylesheet" type="text/css" href="/templets/html/shop/css/css.css" />
<link href="/templets/html/shop/css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="/templets/html/shop/js/tab.js"></script>
	<script type='text/javascript' src='/dwr/engine.js'></script>
		<script type='text/javascript' src='/dwr/util.js'></script>
		<script type='text/javascript' src='/dwr/interface/Ti_subscribeInfo.js'></script> 
		<script type='text/javascript' src='/templets/html/shop/js/_shop.js'></script>
</head>
<body>
<script> 
  document.write("<s" + "cript type='text/javascript' src='/templets/html/shop/top.jsp?" + Math.random() + "'></scr" + "ipt>");
</script>

<!--content start-->
<div id="content"> 
   <div class="column"><a href="/data/shop.html">雷鸣商城</a><span>&gt;</span><a href="/shop_newslist.html">资讯</a><span>&gt;</span><a href="/shop_newslist.html?cat_attr=XS2dT78fq106V0D|">导购资讯</a></div>
   <!--main start-->
   <div class="main">
     <div class="left">
        <div class="zx_flashzx1">
		 <ul class="hy_listzx1">		 
		<%
			if(newsList!=null && newsList.size()>0){
				Hashtable nMap = null;
				for(int i = 0;i < newsList.size();i++){
					nMap = (Hashtable)newsList.get(i);
					if(nMap!=null&&!(nMap.get("news_id").toString()).equals("0")){
							String title="",content_sub="",file_path="",in_date="",author="",news_id="",title_color="";
							String dateFor = "",infoUrl="";
							if(nMap.get("news_id")!=null){news_id = nMap.get("news_id").toString();
							}
							if(nMap.get("author")!=null){author = nMap.get("author").toString();}
							if(nMap.get("title_color")!=null){title_color = nMap.get("title_color").toString();}
							if(title_color.equals("")) title_color="#333333";
							if(nMap.get("title")!=null){title = nMap.get("title").toString();
								title = getPartLength(title,30);
							}
							if(!s_keyword.equals("")){
								title = title.replace(s_keyword,"<font color='red'>"+s_keyword+"</font>");
							}
							if(nMap.get("file_path")!=null) file_path = nMap.get("file_path").toString();
							if(file_path.equals("")) file_path = "/templets/html/images/cpwu.gif";
							if(nMap.get("publish_date")!=null && !nMap.get("publish_date").toString().equals("")){
								in_date = nMap.get("publish_date").toString();
								if(in_date.length()>10)in_date=in_date.substring(0,10);
							}
							if(nMap.get("content_sub")!=null) {content_sub = nMap.get("content_sub").toString();
							content_sub = getPartLength(content_sub,100);
							}infoUrl = "/data/news/"+in_date+"/"+news_id+".html";
						%>
					    
				    <li class="new"><span><%=in_date%></span>
					<a href="<%=infoUrl%>" style="color:<%=title_color %>" target="_blank"><%=title%></a></li>
						 <%  
						 
						  if(i>0&&i%7==0&&i%42!=0) out.print("</ul><br> <ul class='hy_listzx1'>");
					}
				}
			}else{
		  %>
  
   <li class="new" style="text-align:center">
  <span align="center">没找到您要的信息，请选择其他条件查找</span>
  </li>
	<%}%>	 
	 </ul>	   
		 
		 <div class="detailed_buttom">
				      <ul>
					    <%=pageString%>
					  </ul>
				 </div>
		 
		 
		</div>
		
		
  
     </div>
	 
	  <%
			request.setAttribute("clicknumlist", clicknumlist);
			request.setAttribute("commentnumlist", commentnumlist);
			//request.setAttribute("imagelist", imagelist);
			
		%>
     <div class="right">
	 
	 <div class="zx_j1"><img src="/templets/html/shop/images/zx_x05.gif" /></div>
       <!--px_r_box start-->
       <div class="px_r_box">
          <h2><span><a href="/shop_newslist.html">更多&gt;&gt;</a></span><strong><a href="/shop_newslist.html">评论排行</a></strong></h2>
          <div class="px_r_box_con">
            <ul class="hy_listzx2">
				<%
					if(counter>0){%>
						<c:forEach items="${commentnumlist}" var="memberObj" varStatus="status" begin="0" end="8" step="1" >
		                  <li class="n${status.index+1}"><a href="/data/news/${fn:substring(memberObj.publish_date, 0, 10)}/${memberObj.news_id}.html">
						  <c:choose>
								<c:when test="${fn:length(memberObj.title)>17}">
								${fn:substring(memberObj.title, 0, 15)}...
								</c:when>
								<c:otherwise>
								${memberObj.title}
								</c:otherwise>
								</c:choose></a></li>
						</c:forEach>
					<%}
				 %>
			
               </ul> 
			   </div>
       </div>
	  
       <!--px_r_box end-->
	    <div class="zx_j"><img src="/templets/html/shop/images/zx_x055.gif" /></div>
          <!--px_r_box start-->
       <div class="px_r_boxzx">
          <h2><span><a href="/shop_newslist.html">更多&gt;&gt;</a></span><strong><a href="/shop_newslist.html">最新推荐</a></strong></h2>
          <div class="px_r_box_con">
            <ul class="hy_listzx2">
			<%
					if(counter>0){%>
				<c:forEach items="${clicknumlist}" var="memberObj" varStatus="status" begin="0" end="8" step="1" >

                  <li class="n${status.index+1}"><a href="/data/news/${fn:substring(memberObj.publish_date, 0, 10)}/${memberObj.news_id}.html">
				  <c:choose>
						<c:when test="${fn:length(memberObj.title)>17}">
						${fn:substring(memberObj.title, 0, 15)}...
						</c:when>
						<c:otherwise>
						${memberObj.title}
						</c:otherwise>
						</c:choose></a></li>

				</c:forEach>
				<%}
				 %>
            </ul>
          </div>
       </div>
       
     </div>
     <div class="clear"></div>
   </div>
   <!--main end-->

</div>
</div>
<!--content end-->
<%@ include file="/templets/html/shop/footer.jsp" %>
</body>
</html>
